﻿<!DOCTYPE html>
<html>
<head>
    <title>创建列</title>$css()
</head>
<body>
 <div class="tabarea">

    <div class="tab_mini">
        <a href="?module=table&amp;action=all">所有表</a>
        <a href="?module=table&amp;action=columns&amp;tableid=${tableid}"  class="current" id="btnlink">结构</a>
        <a href="?module=table&amp;action=createcolumn&amp;tableid=${tableid}" id="btnlink_create">创建列</a>
        <a href="?module=table&amp;action=rows&amp;control=true&amp;tableid=${tableid}">数据</a>
        <span class="meta">表名：<span>${tablename}</span></span>
    </div>
    
    <div class="area">
    <div class="form">
        <form method="post" action="" enctype="application/x-www-form-urlencoded">
        <dl><dt>列名：</dt><dd><input class="tb_normal ui-box ui-validate" required="true" length="[1,20]" type="text" field="name" value="${name}" /></span></dd></dl>
        <dl><dt>验证：</dt><dd><textarea rows="1" class="tb_normal ui-box ui-validate" length="[0,200]" type="text" field="validformat">${validformat}</textarea></dd></dl>
            <p class="note" style="width:450px;margin-left:100px;">
            验证可选格式：<br />
            1. 不能为空: required="true"<br />
            2. 只能为数字: isnumber="true"<br />
            3. 长度限制:length=[a,b]，a和b为长度数字
            </p>

        <dl><dt>序号：</dt><dd><input class="tb_normal ui-box ui-validate" type="text" isnumber="true" length="[1,2]" field="orderindex" value="${orderindex}" style="width: 60px" /></dd></dl>

        <dl><dt>备注：</dt><dd><input class="tb_normal ui-box ui-validate" length="[0,50]" type="text" field="note" value="${note}" /></dd></dl>
   
        <dl><dt>&nbsp;</dt><dd><input type="hidden" id="tableid" field="tableid" value="${tableid}" />
        <input type="hidden" id="columnid" field="columnid" value="${columnid}" />
  <a href="javascript:;" class="btn"onclick="return submitForm();">提交</a></dd></dl>
        </form>
    </div>
    </div>

</div>

$js()
    <script type="text/javascript">
        if (location.href.indexOf('edit') == -1) {
            jr.$('btnlink').className = '';
            jr.$('btnlink_create').className = 'current';
        }
        function submitForm() {
            if (jr.validator.validate()) {
                var data = jr.json.toObject(document);
                jr.xhr.post(location.href, data, function (x) {

                    var msg = '';
                    var resultTag; eval('resultTag=' + x);
                    switch (resultTag) {
                        default: msg = location.href.indexOf('edit') != -1 ? '保存成功!' : '添加成功!'; break;
                    }

                   showMsg2msg,function () {
                        location.replace('?module=table&action=columns&tableid=' + jr.val('tableid'));
                    });
                });
            }
            return false;
        }


    </script>
</body>
</html>
